Attribute VB_Name = "modTranspose"
Sub Main()

    frmTranspose.Show
    frmTranspose.txtEnd = "G"
    frmTranspose.txtStart = "G#"

End Sub


Sub DoTheTransposeBaby(ByVal strStartKey, ByVal strEndKey)


    Selection.HomeKey Unit:=wdLine
    Selection.endKey Unit:=wdLine, Extend:=wdExtend
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    modTranspose.subChordFont



    Dim wrdRange As Word.Range
    
    Set wrdRange = ThisDocument.Application.Selection.Range
    
    Dim intAbsurdityCounter As Integer
    intAbsurdityCounter = 0
    
    While ((wrdRange.Start <> wrdRange.End) And _
            (intAbsurdityCounter < 10000))
        intAbsurdityCounter = intAbsurdityCounter + 1
        Dim rngSubRange As Word.Range
        Set rngSubRange = wrdRange.Characters(1)
        If modTranspose.fnNoteStr2Int(rngSubRange.Text) Then
            If (wrdRange.End - wrdRange.Start > 1) Then
                Dim strSecondChar As String
                strSecondChar = Right(Left(wrdRange.Text, 2), 1)
                If ((strSecondChar = "#") Or (strSecondChar = "b")) Then
                    rngSubRange.SetRange _
                        Start:=rngSubRange.Start, _
                        End:=rngSubRange.End + 1
                End If
            End If
            rngSubRange.Text = modTranspose.fnStrNoteStart2End _
                (rngSubRange.Text, strStartKey, strEndKey)
            wrdRange.MoveStart Unit:=wdCharacter, _
                Count:=Len(rngSubRange.Text)
        Else
            wrdRange.MoveStart Unit:=wdCharacter, _
                Count:=Len(rngSubRange.Text)
        End If
    Wend
    
    modTranspose.subChordFont
    
'    Selection.endKey Unit:=wdLine
'    Selection.MoveRight Unit:=wdCharacter, Count:=1
'    Selection.HomeKey Unit:=wdLine
'    Selection.endKey Unit:=wdLine, Extend:=wdExtend
'    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    Selection.HomeKey Unit:=wdLine
    Selection.endKey Unit:=wdLine, Extend:=wdExtend
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend


End Sub





Public Function fnChangeNote(ByVal strNote)

    Select Case strNote
        Case "c"
            fnChangeNote = "C"
            
        Case "c#"
            fnChangeNote = "C#"
        Case "db"
            fnChangeNote = "Db"
        Case "DB"
            fnChangeNote = "Db"
            
        Case "d"
            fnChangeNote = "D"
            
            
        Case "d#"
            fnChangeNote = "D#"
        Case "eb"
            fnChangeNote = "Eb"
        Case "EB"
            fnChangeNote = "Eb"
            
        Case "e"
            fnChangeNote = "E"
            
        Case "f"
            fnChangeNote = "F"
            
        Case "f#"
            fnChangeNote = "F#"
            
        Case "g"
            fnChangeNote = "G"
            
        Case "g#"
            fnChangeNote = "G#"
        Case "ab"
            fnChangeNote = "Ab"
        Case "AB"
            fnChangeNote = "AB"
            
        Case "a"
            fnChangeNote = "A"
            
        Case "bb"
            fnChangeNote = "Bb"
        Case "BB"
            fnChangeNote = "Bb"
            
        Case "b"
            fnChangeNote = "B"
        
        Case Else
            fnChangeNote = strNote
    End Select

End Function


Public Function fnNoteInt2String(ByVal intNote)
    Select Case intNote
        Case 1
            fnNoteInt2String = "C"
            
        Case 2
            fnNoteInt2String = "C#"
            
        Case 3
            fnNoteInt2String = "D"
            
        Case 4
            fnNoteInt2String = "Eb"
            
        Case 5
            fnNoteInt2String = "E"
            
        Case 6
            fnNoteInt2String = "F"
            
        Case 7
            fnNoteInt2String = "F#"
            
        Case 8
            fnNoteInt2String = "G"
            
        Case 9
            fnNoteInt2String = "G#"
            
        Case 10
            fnNoteInt2String = "A"
            
        Case 11
            fnNoteInt2String = "Bb"
            
        Case 12
            fnNoteInt2String = "B"
        
        Case Else
            fnNoteInt2String = " "
    End Select
End Function



Public Function fnNoteStr2Int(ByVal strNote As String)
    Select Case strNote
        Case "C"
            fnNoteStr2Int = 1
            
        Case "C#"
            fnNoteStr2Int = 2
        Case "Db"
            fnNoteStr2Int = 2
            
        Case "D"
            fnNoteStr2Int = 3
            
        Case "D#"
            fnNoteStr2Int = 4
        Case "Eb"
            fnNoteStr2Int = 4
            
        Case "E"
            fnNoteStr2Int = 5
            
        Case "F"
            fnNoteStr2Int = 6
            
        Case "F#"
            fnNoteStr2Int = 7
            
        Case "G"
            fnNoteStr2Int = 8
            
        Case "G#"
            fnNoteStr2Int = 9
        Case "Ab"
            fnNoteStr2Int = 9
            
        Case "A"
            fnNoteStr2Int = 10
            
        Case "Bb"
            fnNoteStr2Int = 11
            
        Case "B"
            fnNoteStr2Int = 12
        
        Case Else
            fnNoteStr2Int = 0
    End Select
    
End Function






Public Function fnStrNoteStart2End(ByVal strStartNote, _
                ByVal strStartKey, ByVal strEndKey)

    Dim intKeyStart As Integer
    Dim intKeyEnd As Integer
    'intStartKey = modTranspose.fnNoteStr2Int(frmTranspose.txtStart.Text)
    'intEndKey = modTranspose.fnNoteStr2Int(frmTranspose.txtEnd.Text)
    intStartKey = modTranspose.fnNoteStr2Int(strStartKey)
    intEndKey = modTranspose.fnNoteStr2Int(strEndKey)



    Dim intStartNote As Integer
    Dim intKeyChange As Integer
    Dim intEndNote As Integer
    intStartNote = modTranspose.fnNoteStr2Int(strStartNote)
    intKeyChange = (intEndKey - intStartKey + 24) Mod 12
    intEndNote = (intStartNote + intKeyChange + 24) Mod 12
    If (intEndNote = 0) Then
        intEndNote = 12
    End If
    fnStrNoteStart2End = modTranspose.fnNoteInt2String(intEndNote)
End Function


Sub sbGetNewCapo(ByVal intStartCapo As Integer, _
                ByVal strStartKey As String, _
                ByVal strEndKey As String, _
                ByRef intEndCapo As Integer)

    Dim intKeyStart As Integer
    Dim intKeyEnd As Integer
    intStartKey = modTranspose.fnNoteStr2Int(strStartKey)
    intEndKey = modTranspose.fnNoteStr2Int(strEndKey)

    intEndCapo = (intStartCapo + intStartKey - intEndKey + 12 * 3) Mod 12
    If (intEndCapo = 12) Then ' this should never actually happen anyways
        intEndCapo = 0
    End If
End Sub





Sub subChordFont()
    If Len(Selection.Text) > 1 Then
    Debug.Print Selection.Text
    Dim sfontname As String
    sfontname = Selection.Font.Name
    
    Dim iLeftLineStyle As Long
    Dim iLeftLineWidth As Long
    Dim iLeftLineColor As Long
    
    Dim iBottomLineStyle As Long
    Dim iBottomLineWidth As Long
    Dim iBottomLineColor As Long
    
    With Selection.ParagraphFormat
        With .Borders(wdBorderLeft)
        If Not .LineStyle = wdLineStyleNone Then
            iLeftLineStyle = .LineStyle
            iLeftLineWidth = .LineWidth
            iLeftLineColor = .Color
        End If
        End With
        With .Borders(wdBorderBottom)
        If Not .LineStyle = wdLineStyleNone Then
            iBottomLineStyle = .LineStyle
            iBottomLineWidth = .LineWidth
            iBottomLineColor = .Color
        End If
        End With
    End With
    
    Selection.ClearFormatting
    'WordBasic.ClearAllFormatting
    
    With Selection.ParagraphFormat
        With .Borders(wdBorderLeft)
            .LineStyle = iLeftLineStyle
            .LineWidth = iLeftLineWidth
            .Color = iLeftLineColor
        End With
        With .Borders(wdBorderBottom)
            .LineStyle = iBottomLineStyle
            .LineWidth = iBottomLineWidth
            .Color = iBottomLineColor
        End With
        With .Borders
            .DistanceFromTop = 1
            .DistanceFromLeft = 4
            .DistanceFromBottom = 1
            .DistanceFromRight = 4
            .Shadow = False
        End With
    End With
    
    
    
    
    
    With Selection.Font
        .Name = sfontname
        .Size = 10
        .Bold = True
        .Italic = True
        .Underline = wdUnderlineNone
        .UnderlineColor = wdColorAutomatic
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = False
        .AllCaps = False
        .Color = wdColorAutomatic
        .Engrave = False
        .Spacing = 0
        .Scaling = 100
        .Position = 0
        .Kerning = 0
        .Animation = wdAnimationNone
    End With
    End If
End Sub


Sub highlightNextLine()
    Selection.endKey Unit:=wdLine
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.endKey Unit:=wdLine, Extend:=wdExtend
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
End Sub

Sub transposeentiresong()

    Dim strStartKey As String
    Dim strEndKey As String
    strEndKey = InputBox("What do you want to change the key to be?", "End Key", "G") ', 250, 75)
    If strEndKey = "" Then
        Exit Sub
    End If
    
    strEndKey = modTranspose.fnChangeNote(strEndKey)
    strStartKey = modTranspose.getKey(strEndKey)
    strStartKey = modTranspose.fnChangeNote(strStartKey)
    
    Dim blnIsItStillInTheSong As Boolean
    modTranspose.highlightNextLine
    

    blnIsItStillInTheSong = True
    Dim intAbsurdityCounter As Integer
    intAbsurdityCounter = 0

    While blnIsItStillInTheSong And intAbsurdityCounter <> 80
        intAbsurdityCounter = intAbsurdityCounter + 1
        If blnIsItAChordLine Then
            Call modTranspose.DoTheTransposeBaby(strStartKey, strEndKey)
        End If
        
        Selection.endKey Unit:=wdLine
        Selection.MoveRight Unit:=wdCharacter, Count:=1
        Selection.endKey Unit:=wdLine, Extend:=wdExtend
        Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
        If Len(Selection.Text) > 4 Then
            If Left(Selection.Text, 5) = "Capo:" Then
                Dim intStartCapo As Integer
                GetCapoNumber intStartCapo
                Dim intEndCapo As Integer
                sbGetNewCapo intStartCapo, strStartKey, strEndKey, intEndCapo
                If (intStartCapo > 9) Then
                    SetCapoNumber intEndCapo, 2
                Else
                    SetCapoNumber intEndCapo, 1
                End If
                blnIsItStillInTheSong = False
            End If
        End If
        If Selection.Font.Size > 11 Then
            blnIsItStillInTheSong = False
        End If
    Wend

    
    'fgetKey (getKey)
End Sub


Sub SetCapoNumber(ByVal intCapo As Integer, ByVal intRngLen As Integer)

    Dim wrdRange As Range
    Set wrdRange = ThisDocument.Application.Selection.Range

    Dim rngSubRange As Word.Range
    Set rngSubRange = wrdRange.Characters(1)
    rngSubRange.SetRange Start:=rngSubRange.Start + 5, _
                        End:=rngSubRange.Start + 5 + intRngLen
                        
    rngSubRange.Text = intCapo

End Sub
'        Dim rngSubRange As Word.Range
'        Set rngSubRange = wrdRange.Characters(1)
'        If modTranspose.fnNoteStr2Int(rngSubRange.Text) Then
'            If (wrdRange.End - wrdRange.Start > 1) Then
'                Dim strSecondChar As String
'                strSecondChar = Right(Left(wrdRange.Text, 2), 1)
'                If ((strSecondChar = "#") Or (strSecondChar = "b")) Then
'                    rngSubRange.SetRange _
'                        Start:=rngSubRange.Start, _
'                        End:=rngSubRange.End + 1
'                End If
'            End If
 
 
'
'
'
'
'
'    Dim blnFoundCapo As Boolean
'    blnFoundCapo = False
'    If Len(Selection.Text) = 5 Then
'        intCapo = 0
'        blnFoundCapo = True
'    ElseIf Len(Selection.Text) > 5 Then
'        If Len(Selection.Text) > 6 Then
'            Dim str2Chars As String
'            str2Chars = Mid(Selection.Text, 6, 2)
'            If str2Chars = "11" Then
'                intCapo = 11
'                blnFoundCapo = True
'            End If
'        End If
'        If Not blnFoundCapo Then
'            Dim str1char As String
'            str1char = Mid(Selection.Text, 6, 1)
'            If str1char = "0" Then
'                intCapo = 0
'                blnFoundCapo = True
'            ElseIf str1char = "1" Then
'                intCapo = 1
'                blnFoundCapo = True
'            ElseIf str1char = "2" Then
'                intCapo = 2
'                blnFoundCapo = True
'            ElseIf str1char = "3" Then
'                intCapo = 3
'                blnFoundCapo = True
'            ElseIf str1char = "4" Then
'                intCapo = 4
'                blnFoundCapo = True
'            ElseIf str1char = "5" Then
'                intCapo = 5
'                blnFoundCapo = True
'            ElseIf str1char = "6" Then
'                intCapo = 6
'                blnFoundCapo = True
'            ElseIf str1char = "7" Then
'                intCapo = 7
'                blnFoundCapo = True
'            ElseIf str1char = "8" Then
'                intCapo = 8
'                blnFoundCapo = True
'            ElseIf str1char = "9" Then
'                intCapo = 9
'                blnFoundCapo = True
'            End If
'        End If
'        If Not blnFoundCapo Then
'            intCapo = 0
'        End If
'    End If
'
'End Sub
'




Sub GetCapoNumber(ByRef intCapo As Integer)

    Dim blnFoundCapo As Boolean
    blnFoundCapo = False
    If Len(Selection.Text) = 5 Then
        intCapo = 0
        blnFoundCapo = True
    ElseIf Len(Selection.Text) > 5 Then
        If Len(Selection.Text) > 6 Then
            Dim str2Chars As String
            str2Chars = Mid(Selection.Text, 6, 2)
            If str2Chars = "11" Then
                intCapo = 11
                blnFoundCapo = True
            End If
            If str2Chars = "10" Then
                intCapo = 10
                blnFoundCapo = True
            End If
        End If
        If Not blnFoundCapo Then
            Dim str1char As String
            str1char = Mid(Selection.Text, 6, 1)
            If str1char = "0" Then
                intCapo = 0
                blnFoundCapo = True
            ElseIf str1char = "1" Then
                intCapo = 1
                blnFoundCapo = True
            ElseIf str1char = "2" Then
                intCapo = 2
                blnFoundCapo = True
            ElseIf str1char = "3" Then
                intCapo = 3
                blnFoundCapo = True
            ElseIf str1char = "4" Then
                intCapo = 4
                blnFoundCapo = True
            ElseIf str1char = "5" Then
                intCapo = 5
                blnFoundCapo = True
            ElseIf str1char = "6" Then
                intCapo = 6
                blnFoundCapo = True
            ElseIf str1char = "7" Then
                intCapo = 7
                blnFoundCapo = True
            ElseIf str1char = "8" Then
                intCapo = 8
                blnFoundCapo = True
            ElseIf str1char = "9" Then
                intCapo = 9
                blnFoundCapo = True
            End If
        End If
        If Not blnFoundCapo Then
            intCapo = 0
        End If
    End If

End Sub



Public Function getKey(ByVal strEndKey) '(ByVal strKey As String)

    Dim currRang As Range
    Set currRang = Selection.Range
    
    Dim loopforever As Boolean
    loopforever = True
    While loopforever
        Selection.HomeKey Unit:=wdLine
        Selection.MoveLeft Unit:=wdCharacter, Count:=1
        If Selection.Font.Size > 11 Then
            Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
            If Selection.Text = ")" Then
                Selection.MoveLeft Unit:=wdCharacter, Count:=1
                Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
                If ((Selection.Text = "#") Or (Selection.Text = "b")) Then
                    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
                End If
                getKey = Selection.Text
                Selection.Text = strEndKey
                loopforever = False
            Else
                MsgBox ("Error in getKey function")
            End If
        End If
    Wend
    '    currRang.Select
End Function

Function blnIsItAChordLine()

    Selection.HomeKey Unit:=wdLine
    Selection.endKey Unit:=wdLine, Extend:=wdExtend
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend

    Dim wrdRange As Word.Range
    
    Set wrdRange = ThisDocument.Application.Selection.Range
        Dim strArray() As String

    strArray = Split(" c e f g h i k l n o " & _
        "p q r t v w y z H I J K L M N O P" & _
        "Q R S T U V W X Y Z ,")



    Dim intAbsurdityCounter As Integer
    intAbsurdityCounter = 0
    blnIsItChord = 1
    While ((wrdRange.Start <> wrdRange.End) And _
            (intAbsurdityCounter < 10000))
        intAbsurdityCounter = intAbsurdityCounter + 1
        Dim rngSubRange As Word.Range
        Set rngSubRange = wrdRange.Characters(1)
        For Each letter In strArray
            If rngSubRange.Text = letter Then
                blnIsItChord = 0
            End If
        Next letter
        wrdRange.MoveStart Unit:=wdCharacter, _
            Count:=Len(rngSubRange.Text)
    Wend

    blnIsItAChordLine = blnIsItChord
    

End Function

Function blnIsItAChordChar()
'------------ESCAPE------------
    blnIsItAChordChar = False
    For Each letter In Split("A B C D E F G m s u 2 3 4 5 6 7 8 9 a j / ( ) # b * x")
        If Selection.Text = letter Then
            blnIsItAChordChar = True
        End If
    Next letter
    

End Function


Function blnIsItTheLineStart()
'----------ESCAPE---------

    Dim memorizedRange As Range
    Set memorizedRange = Selection.Range
    Selection.HomeKey Unit:=wdLine
    Dim intStartOfLine As Long
    intStartOfLine = Selection.Start
    memorizedRange.Select
    blnIsItTheLineStart = (Selection.Start = intStartOfLine)
'
'    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
'    If Selection.Text = "whateveritis" Then
'
'        blnIsItTheLineStart = True
'    End If
'        MsgBox (Selection.IsEndOfRowMark)
'
'    Selection.MoveRight Unit:=wdCharacter, Count:=1
    
    
End Function

Sub SongsifyEntiresong()
    
    Dim loopforever As Boolean
    
    Selection.HomeKey Unit:=wdLine
    Selection.endKey Unit:=wdLine, Extend:=wdExtend
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    
    loopforever = True
    Dim intInsanityCounter As Integer
    intInsanityCounter = 0

    While (loopforever And (intInsanityCounter <> 100))
        intInsanityCounter = intInsanityCounter + 1
        If blnIsItAChordLine Then
            Call modTranspose.SongsifyIt
        End If
        Selection.endKey Unit:=wdLine
        Selection.MoveRight Unit:=wdCharacter, Count:=1
        
        Selection.endKey Unit:=wdLine, Extend:=wdExtend
        Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
        If Len(Selection.Text) > 4 Then
            If Left(Selection.Text, 5) = "Capo:" Then
                loopforever = False
            End If
        End If
    Wend

    
    'fgetKey (getKey)
End Sub


Sub SongsifyIt()
'
' Macro8 Macro
'
'

    Selection.endKey Unit:=wdLine
    Dim blnWasItEverAChord As Boolean
    Dim strCutChord As String
    Dim rngChordLineEnd As Range
    Dim blnContinueLeft As Boolean
    
    While Not blnIsItTheLineStart
        Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
        blnWasItEverAChord = False
        
        blnContinueLeft = blnIsItAChordChar
        While blnContinueLeft
            blnWasItEverAChord = True

            Selection.MoveLeft Unit:=wdCharacter, Count:=1
            If blnIsItTheLineStart Then
                blnContinueLeft = False
            Else
                Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
                blnContinueLeft = modTranspose.blnIsItAChordChar
            End If
            
        Wend
        If blnWasItEverAChord Then
            Set rngChordLineEnd = Selection.Range
            Selection.MoveRight Unit:=wdCharacter, Count:=1
            Selection.endKey Unit:=wdLine, Extend:=wdExtend
            Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
            strCutChord = Selection.Text
            Selection.Delete
            Selection.MoveDown Unit:=wdLine, Count:=1
            Selection.TypeText Text:="\[" & strCutChord & "]"
            rngChordLineEnd.Select
        End If
        'the selection at this point is always the last not-chord character
        'at the end of the line
        Selection.MoveLeft Unit:=wdCharacter, Count:=1
        Selection.Delete
    Wend
    Selection.Delete

End Sub


Sub loadInformation()
    Dim iEntry As Integer
    Dim blnHitCopyrightYet As Boolean
    Dim iCopyright As Integer
    Dim blnHitScriptureYet As Boolean
    blnHitScriptureYet = False
    blnHitCopyrightYet = False
    iEntry = 0
    If Len(Selection.Text) > 4 Then
        If Left(Selection.Text, 5) = "Capo:" Then
            With frmSong
                .txt1or2.Text = ""
                .txtAlias.Text = ""
                .txtAuthors.Text = ""
                .txtCapo.Text = ""
                .txtCompany.Text = ""
                .txtCopied.Text = ""
                .txtFont.Text = ""
                .txtKey.Text = ""
                .txtRefKey.Text = ""
                .txtRefNote.Text = ""
                .txtScripture.Text = ""
                .txtTempo.Text = ""
                .txtYear.Text = ""
                
                For Each entry In Split(Selection.Text)
                    iEntry = iEntry + 1
                    'If Left(entry, 5) = "Capo:" Then
                    If iEntry = 1 Then
                        .txtCapo.Text = Right(entry, 1)
                    ElseIf iEntry = 2 Then
                    'reference key
                        If Len(entry) = 3 Then
                            .txtRefKey.Text = Right(entry, 2)
                            .txtRefKey.Text = Left(.txtRefKey.Text, 1)
                        ElseIf Len(entry) = 4 Then
                            .txtRefKey.Text = Right(entry, 3)
                            .txtRefKey.Text = Left(.txtRefKey.Text, 2)
                        End If
                    ElseIf iEntry = 3 Then
                    'reference note and 1or2
                        If Len(entry) = 2 Then
                            .txtRefNote.Text = Left(entry, 1)
                        ElseIf Len(entry) = 3 Then
                            .txtRefNote.Text = Left(entry, 2)
                        End If
                        .txt1or2.Text = Right(entry, 1)
                    ElseIf iEntry = 4 Then
                    'If LCase(Left(entry, 5)) = "tempo:" Then
                        .txtTempo = Right(entry, Len(entry) - 6)
                    '
                    'End If
                    ElseIf iEntry = 5 Then
                        iPeriod = InStr(entry, ".")
                        
                        .txtAlias = Left(entry, iPeriod - 1)
                        Select Case LCase(Right(entry, Len(entry) - InStr(entry, ".")))
                            Case "sng"
                                .cmbType.Text = "Song"
                            Case "hym"
                                .cmbType.Text = "Hymn"
                            Case "spr"
                                .cmbType.Text = "Hymn"
                        End Select
                    ElseIf (iEntry > 5) And Not blnHitCopyrightYet Then
                         If entry = ChrW(169) Then
                            blnHitCopyrightYet = True
                            iCopyright = iEntry
                        Else
                            If Len(.txtAuthors.Text) Then
                                .txtAuthors.Text = .txtAuthors.Text & " " & entry
                            Else
                                .txtAuthors.Text = entry
                            End If
                        End If
                    ElseIf iEntry = (iCopyright + 1) Then
                        If Left(entry, 2) = "19" Or Left(entry, 2) = "20" Then
                            .txtYear.Text = entry
                        Else
                            .txtCompany.Text = .txtCompany.Text & entry
                        End If
                    ElseIf Not blnHitScriptureYet Then
                        If LCase(entry) = "scripture:" Then
                            blnHitScriptureYet = True
                        Else
                            If Len(.txtCompany.Text) Then
                                .txtCompany.Text = .txtCompany.Text & " " & entry
                            Else
                                .txtCompany.Text = entry
                            End If
                        End If
                    Else
                        If Len(.txtScripture.Text) Then
                            .txtScripture.Text = .txtScripture.Text & " " & entry
                        Else
                            .txtScripture.Text = entry
                        End If
                            
                    End If
                Next entry
            End With
        End If
    End If

    frmSong.Show
End Sub

Sub writeChar()

    MsgBox (ChrW(169))
End Sub
Sub theLoadUserFormFunction()

    frmSong.txtCopied.Text = Application.Selection.Text
    frmSong.cmbType.AddItem "Song"
    frmSong.cmbType.AddItem "Spiritual Song"
    frmSong.cmbType.AddItem "Hymn"
    frmSong.cmbType.Text = "Song"
    frmSong.txt1or2.Text = 1
    
    
    
    
    
    frmSong.Show
End Sub
